package deepbrain.simnetwork.monitor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import deepbrain.simnetwork.network.NetworkState;
import deepbrain.simnetwork.task.SimulationTask;

public class MapLogMonitor<WeightType, MapKey> extends MonitorAdapter<SimulationTask>
		implements SimTaskMonitor {

	protected Map<MapKey, List<NetworkState>> map;
	protected MapKey mapKey;
	protected List<NetworkState> networkStates;

	public MapLogMonitor() {
		map = new HashMap<MapKey, List<NetworkState>>();
	}

	@Override
	public void onTaskStart(SimulationTask task) {
		networkStates = new ArrayList<NetworkState>();
	}

	@Override
	public void onStepFinish(SimulationTask task) {
		networkStates.add(task.getNetworkState());
	}

	@Override
	public void onTaskFinish(SimulationTask task) {
		map.put(mapKey, networkStates);
	}

	public void setMapKey(MapKey mapKey) {
		this.mapKey = mapKey;
	}

	public Map<MapKey, List<NetworkState>> getLogMap() {
		return map;
	}

}
